<%--
  Created by IntelliJ IDEA.
  User: DELL
  Date: 2020/11/11
  Time: 19:34
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<html>
<head>
    <title>个人信息管理</title>
    <style type="text/css" rel="stylesheet">
        body{
            font-family: "楷体";
            font-size: 16px;
        }
        .all{
            width: 850px;
            max-height: 550px;
            overflow: auto;
            border: 2px solid red;
            margin: 0 auto;
            padding: 50px 30px;
            box-sizing: border-box;
            margin-top: 25px;
        }
        .yheader{
            font-size: 18px;
            font-weight: 600;
            color: red;
            margin-bottom: 10px;
        }
        table{
            width: 600px;
            margin: 0 auto;
        }
    </style>
    <script src="/WebContent/JQuery/jquery-3.4.1.js" type="text/javascript"></script>
</head>
<body>
    <article class="all">
        <div class="yheader">当前位置&nbsp;&gt;&gt;&nbsp;个人信息管理</div>
        <div id="box">

        </div>

    </article>
<script>
    $(document).ready(function () {
         $.ajax({
             url:"/AdminLoginServlet?type=cxmydata",
             type:"get",
             data:"id="+${sessionScope.admin.adminId},
             dataType:"json",
             success:function (data) {
                  collback(data);
             },
             error:function (error) {
                  alert("请求失败！");
             }
         })

        var collback = function (data) {
            if(data.length > 0){
                var role = "普管";
                var $table = $("<table border='1'></table>").appendTo("#box");
                var $tr = $("<tr></tr>").appendTo($table);
                $("<th></th>").html("用户名").appendTo($tr);
                $("<th></th>").html("邮件地址").appendTo($tr);
                $("<th></th>").html("注册时间").appendTo($tr);
                $("<th></th>").html("角色类型").appendTo($tr);

                $.each(data,function (index,item) {
                     if(item.adminRoleType == 1){
                         role = "超管";
                     }else{
                         role = "普管";
                     }
                    var $tr = $("<tr></tr>").appendTo($table);
                    $("<th></th>").html(item.adminUsername).appendTo($tr);
                    $("<th></th>").html(item.adminEmail).appendTo($tr);
                    $("<th></th>").html(item.adminRegisterTime).appendTo($tr);
                    $("<th></th>").html(role).appendTo($tr);
                })
            }
        }
    })
</script>
</body>
</html>
